﻿using System.Data;
using WMS.FC.Domain.DomainObject.System;
using WMS.FC.Domain.PersistenceObject;

namespace WMS.FC.Domain.Repository
{
    public interface ISplitTableRepository : IRepositoryBase
    {
        /// <summary>
        /// 获取表信息
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <returns></returns>
        Task<SplitTableEntityInfo> GetSplitTableEntityInfo<TSource>() where TSource : HistoryPOBase;

        /// <summary>
        /// 获取表信息
        /// </summary>
        /// <param name="entityType"></param>
        /// <returns></returns>
        Task<SplitTableEntityInfo> GetSplitTableEntityInfo(Type entityType);

        /// <summary>
        /// 初始化表
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <returns></returns>
        Task InitializeTable<TSource>() where TSource : HistoryPOBase;

        /// <summary>
        /// 插入数据
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="entity"></param>
        /// <param name="userInfo"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        Task<int> InsertSplitTable<TSource>(TSource entity, UserInfo userInfo, DateTime? dateTime = null) where TSource : HistoryPOBase;

        /// <summary>
        /// 插入数据
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="entityList"></param>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        Task<int> InsertSplitTable<TSource>(List<TSource> entityList, UserInfo userInfo) where TSource : HistoryPOBase;

        /// <summary>
        /// 查询分表数据
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="parameters"></param>
        /// <param name="pagination"></param>
        /// <param name="sorter"></param>
        /// <returns></returns>
        Task<DataTable?> ExecuteQuery<TSource>(DateTime startTime, DateTime endTime, Dictionary<string, object>? parameters = null, Pagination? pagination = null, Sorter? sorter = null) where TSource : HistoryPOBase;
    }
}
